//
//  PhoneCodeViewController.m
//  TaurusXi
//
//  Created by xicheng on 15/12/6.
//  Copyright © 2015年 xicheng. All rights reserved.
//

#import "PhoneCodeViewController.h"
#import "BindCardTipsViewController.h"
@interface PhoneCodeViewController ()
@property (weak, nonatomic) IBOutlet UITextField *codeField;
@property (weak, nonatomic) IBOutlet UILabel *phoneLable;
@property (weak, nonatomic) IBOutlet UIButton *sendCodeAgainButton;
@property (weak, nonatomic) IBOutlet UIButton *modifyButton;
@property (weak, nonatomic) IBOutlet UIButton *sendButton;
@property (weak, nonatomic) IBOutlet UIButton *gotToLoginButton;

@end

@implementation PhoneCodeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  [self setTitleText:@"手机号码认证"];
  self.phoneLable.text = [NSString stringWithFormat:@"手机号码：%@",self.phoneNumbStr];
  
  [self.sendButton addTarget:self action:@selector(sendCode) forControlEvents:UIControlEventTouchUpInside];
  
    // Do any additional setup after loading the view from its nib.
}


-(void)sendCode{

  [self showSimplePro];
  
  @weakify(self);
  [[Api shareApiInstance] registerSecondWithPhoneNumb:self.phoneNumbStr AndSMSCode:self.codeField.text AndInviteNo:@"" AndPopularizeNo:@"" AndSmsId:self.smsId AndResponce:^(id object) {
    @strongify(self);
     [self hideSimpleProWithDelay:0];
    if([[object objectForKey:@"code"] isEqualToString:@"10000"]){

    BindCardTipsViewController *target = [[BindCardTipsViewController alloc]initWithNibName:@"BindCardTipsViewController" bundle:nil];
    target.setPasswordFlag = YES;
    [self.navigationController pushViewController:target animated:YES];
    }
  } AndError:^(id object, NSError *error) {
    @strongify(self);
    [self hideSimpleProWithDelay:0];
    
  }];
  
  
  
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
